<div class="slide-dialog-header">
	<h2>{{title}}</h2>
	<div class="slide-dialog-toolbar">
		<ul>
			<li><span class="ui-btn slide-dialog-close" ng-click="close(false)"><i class="fa fa-remove"></i></span></li>
		</ul>
	</div>
</div>
<div class="slide-dialog-body x-slide-dialog-body">
	<div class="x-data-panel-fixed">
		<form name="form" novalidate="novalidate" ng-submit="submit(form.$valid);" autocomplete="off">
			<div class="x-data-panel-body">
				<uib-tabset active="active">
					<uib-tab index="0" heading="用户信息">
						<div class="data-form">
							<dl>
								<dt><span class="x-star">*</span>用户名：</dt>
								<dd>
									<input type="text" name="username" ng-model="data.username" class="x-ipt" placeholder="请输入用户名" remote="{name: 'org_user_valid', params: {id: data.id}}" ng-disabled="data.id" maxlength="20" minlength="2" required />
									<div class="x-error" ng-if="interacted(form.username)" ng-messages="form.username.$error">
									    <span ng-message="minlength">用户名不能少于两个字符</span>
		                                <span ng-message="required">用户名不能为空</span>
		                                <span ng-message="remote">用户名已存在</span>
		                            </div>
								</dd>
							</dl>
							<dl ng-if="data.id == null">
								<dt><span class="x-star">*</span>密码：</dt>
								<dd>
									<input type="password" autocomplete="new-password" name="password" ng-model="data.password" class="x-ipt" password="^[a-zA-Z0-9_]+$"  placeholder="请输入密码" minlength="6" maxlength="32" required />
									<div class="x-error" ng-if="interacted(form.password)" ng-messages="form.password.$error">
		                                <span ng-message="required">密码不能为空</span>
		                                <span ng-message="minlength">密码不能少于六位数</span>
		                                <span ng-message="maxlength">密码不能多于三十二位数</span>
		                                <span ng-message="password">密码要求数字、大小写字母以及下划线的组合</span>
		                            </div>
								</dd>
							</dl>
							<dl ng-if="data.id == null">
								<dt><span class="x-star">*</span>确认密码：</dt>
								<dd>
									<input type="password" autocomplete="new-password" name="confirmPassword" ng-model="data.confirmPassword" class="x-ipt" password-matcher="data.password" placeholder="请再次输入密码" required />
									<div class="x-error" ng-if="interacted(form.confirmPassword)" ng-messages="form.confirmPassword.$error">
		                                <span ng-message="required">确认密码不能为空</span>
		                                <span ng-message="passwordmatcher">两次输入的密码不一致</span>
		                            </div>
								</dd>
							</dl>
							<dl>
								<dt><span class="x-star">*</span>真实姓名：</dt>
								<dd>
									<input type="text" name="realname"  maxlength="20" ng-model="data.realname" class="x-ipt" placeholder="请输入真实姓名" required />
									<div class="x-error" ng-if="interacted(form.realname)" ng-messages="form.realname.$error">
		                                <span ng-message="required">真实姓名不能为空</span>
		                            </div>
								</dd>
							</dl>
							<dl>
								<dt>联系电话：</dt>
								<dd><input type="text" name="mobile" ng-model="data.mobile" class="x-ipt" placeholder="请输入联系电话" ng-pattern="/^\d{11}$/" />
								    <div class="x-error" ng-if="interacted(form.mobile)" ng-messages="form.mobile.$error">
								        <span ng-message="pattern">请输入十一位手机号码</span>
                                   </div>
								</dd>
							</dl>
							<dl>
								<dt>email：</dt>
								<dd><input type="email" name="email" ng-model="data.email" class="x-ipt" placeholder="请输入电子邮箱" />
								   <div class="x-error" ng-if="interacted(form.email)" ng-messages="form.email.$error">
								        <span ng-message="email">请输入正确的邮箱地址</span>
                                   </div>
								</dd>
							</dl>
						</div>
					</uib-tab>
					<uib-tab index="1" heading="所属部门">
						<div kendo-tree-view="$parent.$parent.tree" k-options="treeOptions">
			                <span class="k-node" k-template>
			                    <i class="fa fa-{{dataItem.className || 'folder-open'}}"></i> {{dataItem.text}}
			                </span>
			            </div>
					</uib-tab>
					<uib-tab index="2" heading="所属角色">
						<div class="data-form">
							<table cellspacing="0" cellpadding="0">
								<colgroup>
									<col />
									<col width="46" />
									<col />
								</colgroup>
								<tbody>
									<tr>
										<td><select ng-model="cache_select_roles" multiple class="x-multiple" ng-options="m.id as m.name for m in roles"></select></td>
										<td class="align-middle"><span class="ui-button" ng-click="moveAdd(cache_select_roles, data.roles)"><i class="fa fa-angle-double-right"></i></span><span class="ui-button" ng-click="moveRemove(data.roles, cache_target_roles)"><i class="fa fa-angle-double-left"></i></span></td>
										<td><select ng-model="cache_target_roles" ng-init="data.roles=data.roles||[]" multiple class="x-multiple" ng-options="m.id as m.name for m in data.roles"></select></td>
									</tr>
								</tbody>
							</table>
						</div>
					</uib-tab>
				</uib-tabset>
			</div>
			<div class="x-data-panel-footer">
				<button class="dialog-button cancel-button" type="button" ng-click="close(false)">取消</button><button class="dialog-button" type="submit" ng-disabled="formDisabled">提交</button>
			</div>
		</form>
	</div>
</div>